home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / PartMaker 4.4 / PartMaker Documents / Script Runner• / Script Runner•.rsrc / dFRK_5065 < prev    next >
Encoding:
Text File  |  1995-12-12  |  2.3 KB  |  109 lines

  1. /*
  2.     File:        ScriptRunnerUtils.cpp
  3.  
  4.     Contains:    ScriptRunner utility functions & classes
  5.  
  6.     Written by:    Steve Smith
  7.  
  8.     Copyright:    © 1994-95 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. // -- OpenDoc Utilities --
  12.  
  13. #ifndef _EXCEPT_
  14. #include <Except.h>
  15. #endif
  16.  
  17. // --- ScriptRunner Includes ---
  18.  
  19. #ifndef _SCRIPTRUNNERUTILS_
  20. #include "ScriptRunnerUtils.h"
  21. #endif
  22.  
  23. #ifndef _SCRIPTRUNNERDEF_
  24. #include "ScriptRunnerDef.h"
  25. #endif
  26.  
  27. // --- OpenDoc Includes ---
  28.  
  29. #ifndef _ODTYPES_
  30. #include <ODTypes.h>
  31. #endif
  32.  
  33. #ifndef SOM_Module_OpenDoc_StdTypes_defined
  34. #include <StdTypes.xh>
  35. #endif
  36.  
  37. #ifndef SOM_Module_OpenDoc_StdDefs_defined
  38. #include <StdDefs.xh>
  39. #endif
  40.  
  41. // -- OpenDoc Utilities --
  42.  
  43. #ifndef _ODMEMORY_
  44. #include <ODMemory.h>
  45. #endif
  46.  
  47. #ifndef _STDTYPIO_
  48. #include <StdTypIO.h>
  49. #endif
  50.  
  51. // --- Macintosh Includes ---
  52.  
  53. #ifndef __GXMATH__
  54. #include <GXMath.h>
  55. #endif
  56.  
  57.  
  58. //====================================================================
  59. // Utility Functions
  60. //====================================================================
  61.  
  62. //--------------------------------------------------------------------
  63. // FixedToIntRect
  64. //--------------------------------------------------------------------
  65.  
  66. void FixedToIntRect(ODRect& fixedRect, Rect& intRect)
  67. {
  68.     intRect.top        = FixedToInt(fixedRect.top);
  69.     intRect.left    = FixedToInt(fixedRect.left);
  70.     intRect.bottom    = FixedToInt(fixedRect.bottom);
  71.     intRect.right    = FixedToInt(fixedRect.right);
  72. }
  73.  
  74. //--------------------------------------------------------------------
  75. // IntToFixedRect
  76. //--------------------------------------------------------------------
  77.  
  78. void IntToFixedRect(Rect& intRect, ODRect& fixedRect)
  79. {
  80.     fixedRect.left        = ff(intRect.left);
  81.     fixedRect.top        = ff(intRect.top);
  82.     fixedRect.right        = ff(intRect.right);
  83.     fixedRect.bottom    = ff(intRect.bottom);
  84. }
  85.  
  86. //------------------------------------------------------------------------------
  87. // InvalidateRect
  88. //------------------------------------------------------------------------------
  89.  
  90. void InvalidateRect(    Environment*     ev, 
  91.                         ODFrame*         frame,
  92.                         Rect             bRect )
  93. {
  94.     ODRect        invalidRect;
  95.     ODShape*    invalidShape;
  96.  
  97.     IntToFixedRect(bRect, invalidRect);
  98.         
  99.     invalidShape = frame->CreateShape(ev);
  100.     if(invalidShape)
  101.     {
  102.         invalidShape->SetRectangle(ev, &invalidRect);
  103.     
  104.         frame->Invalidate(ev, invalidShape, kODNULL);
  105.  
  106.         invalidShape->Release(ev);
  107.     }
  108. }
  109.